
import grails.test.*
import grails.plugin.spock.*

/**
 * Test User Controller.
 */
class UserControllerSpec extends ControllerSpec {
	
	
	def 'authenticate action'() {
		setup:
		mockDomain(User)
		def u = new User(userName: "admin", password: "test_pwd", firstName: "first name")
		u.save()
		
		when:
		mockParams.userName = 'invalid_user'
		mockParams.password = 'test_pwd'
		controller.authenticate(mockParams)
		
		then:
		controller.redirectArgs.action == "list"
	}
}
